<extend name="Base/common"/>
<block name="Content">
    <div class="am-cf am-padding-top">
        <div class="am-fl am-cf">
            <notempty name="adminModel">
                <i class="am-icon-pencil-square-o"></i>
                <else/><i class="am-icon-plus-square"></i>
            </notempty>
            <strong class="am-text-primary am-text-lg">
                <notempty name="adminModel">
                    编辑<else/>新增
                </notempty>用户
            </strong>
        </div><hr data-am-widget="divider" class="am-divider am-divider-default" />
    </div>
    <form method="post" class="am-form" action="{:U('saveAction')}">
        <div class="am-tabs" data-am-tabs>
            <ul class="am-tabs-nav am-nav am-nav-tabs">
                <li class="am-active">
                    <a href="#tab1">用户信息</a>
                </li>
                <li>
                    <a href="#tab2">个人信息</a>
                </li>
            </ul>
            <div class="am-tabs-bd">
                <div class="am-tab-panel am-fade am-in am-active" id="tab1">
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户帐号 
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                            <notempty name="adminModel">
                                <input type="text" name="admin_account" class="am-form-field am-input-sm" 
                                	value="{$adminModel['admin_account']}" readonly="readonly"/>
                            <else/>
                            	<input type="text" name="admin_account" class="am-form-field am-input-sm" 
                            		value="{$adminModel['admin_account']}" required/>
                            </notempty>
                        </div>
                        <div class="am-hide-sm-only am-u-md-7">
                            *必填，不可重复
                        </div>
                    </div>
                    
                    <notempty name="adminModel">
                    <else/>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户密码
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                             <input type="password" name="password" id="password" 
                             	class="am-form-field am-input-sm" value="{$init_pwd}" />
                        </div>
                        <div class="am-hide-sm-only am-u-md-7">
                            *新增用户初始密码：{$Think.config.INIT_PWD}
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            确认密码
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                             <input type="password" name="password" class="am-form-field am-input-sm" value="{$init_pwd}"
                              	data-equal-to="#password" required/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-7">
                        </div>
                    </div>
                    </notempty>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户姓名 
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                            <input type="text" name="admin_name" class="am-input-sm" value="{$adminModel['admin_name']}" required/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-7">
                            *必填
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户角色
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <select name="role_id">
                                <foreach name="roleList" item="role">
                                    <option value="{$role.role_id}">{$role.role_name}</option>
                                </foreach>
                            </select>
                        </div>
						 <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            可管理站点
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <select name="site_id" data-am-selected="{dropUp: 1, btnSize: 'sm', maxHeight: 200, searchBox:1}">
                            	<option value="0">全部</option>
                                <foreach name="siteList" item="site">
                                    <option value="{$site.site_id}">{$site.site_name}</option>
                                </foreach>
                            </select>
                        </div>
						 <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户状态 
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <select data-am-selected="{ btnSize: 'sm', btnStyle: 'secondary',dropUp: 1}" name="admin_status">
                                <option value="1">正常</option>
                                <option value="2">禁用</option>
                            </select>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                </div>
                
                <div class="am-tab-panel am-fade" id="tab2">
                	<div class="am-g am-margin-top-sm">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户昵称
                        </div>
                        <div class="am-u-sm-8 am-u-md-3 am-u-end">
                            <input type="text" class="am-input-sm" name="nick_name" value="{$adminModel['nick_name']}"/>
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            性别 
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                            <input type="radio" name="sex" value="0"
                            <if condition="$adminModel['sex'] eq '0'">
                                checked="checked"
                            </if>/>男<input type="radio" name="sex" value="1"
                            <if condition="$adminModel['sex'] eq '1'">
                                checked="checked"
                            </if>/>女 
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            手机号
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                            <input type="text" class="am-input-sm" value="{$adminModel['mobile']|default=' '}" name="mobile" />
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                           
                        </div>
                    </div>
                    <div class="am-g am-margin-top-sm">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            邮箱地址
                        </div>
                        <div class="am-u-sm-8 am-u-md-3 am-u-end">
                            <input type="email" class="am-input-sm" name="email" value="{$adminModel['email']}"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="am-margin">
            <button type="submit" class="am-btn am-btn-success am-btn-xs ajax-post" target-form="am-form">
                提交保存
            </button>
            <button type="button" class="am-btn am-btn-secondary am-btn-xs" onclick="javascript:history.back(-1);return false;">
                返回列表
            </button>
            <input type="hidden" value="{$adminModel['admin_id']}" name="admin_id"/>
        </div>
    </form>
</block>
<block name="script">
    <script type="text/javascript">
		Think.setValue('role_id',{$adminModel.role_id|default=0});
		Think.setValue('site_id',{$adminModel.site_id|default=0});
		Think.setValue('sex',{$adminModel.sex|default=0});
  	    Think.setValue('admin_status',{$adminModel.admin_status|default=0});
    </script>
</block>
